import { defineStore } from 'pinia'

interface MockInfo {
  id: number
  name: string
  desc: string
}

interface App {
  id: number
  name: string
  icon: string
  url: string
}

interface News {
  id: number
  title: string
  date: string
  category: string
  important: boolean
}

export const useWebsiteStore = defineStore('websiteStore', {
    state: () => ({
      apps: [] as App[],
      news: [] as News[]
    }),
    actions: {
      async fetchApps() {
        const apps = await $fetch<App[]>('http://localhost:5000/apps')
        this.apps = apps
      },
      async fetchNews() {
        const news = await $fetch<News[]>('http://localhost:5000/news')
        this.news = news
      }
    }
  })
  